package com.becca.cake.model.category;

import java.io.Serializable;
import java.util.Date;

import com.becca.cake.core.exception.ServiceException;

/**
 * 商品分类管理
 * @copyright  尊星(上海)信息科技有限公司
 * @author mouwanming
 *
 */
public class GoodCategoryModel implements Serializable
{
	/**商品分类不能为空*/
	private final static String CATEGORY_ID_NULL = "商品分类不能为空";
	/**商品分类状态不能为空*/
	private final static String CATEGORY_STATUS_NULL = "商品分类状态不能为空";
    /**分类状态：（禁用：1）*/
    public static final Byte CATEGORY_STATUS_FORBIDDEN = 1;
    /**分类状态：（正常：0）*/
    public static final Byte CATEGORY_STATUS_NOMAL = 0;
    /**该分类已被禁用*/
    public static final String CATEGORY_STATUS_FORBIDDEN_EXIST ="该分类已被禁用";
    /**该分类已启用*/
    public static final String CATEGORY_STATUS_NOMAL_EXIST ="该分类已启用";
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 2411440664634869027L;
	
	private Integer id ;
	/**分类名称*/
	private String categoryName;
	/**分类拼音名*/
	private String categoryNamePingyin;
	/**分类状态（0：可用 1：禁用）*/
	private Byte categoryStatus;
	/**排序*/
	private Integer categoryOrder;
	 /**创建时间*/
    private Date    createdDate;
    /**创建人*/
    private String  createdName;
    /**修改时间*/
    private Date    updatedDate;
    /**修改人*/
    private String  updatedName;
    
	public Integer getId()
	{
		return id;
	}
	public void setId(Integer id)
	{
		this.id = id;
	}
	public String getCategoryName()
	{
		return categoryName;
	}
	public void setCategoryName(String categoryName)
	{
		this.categoryName = categoryName;
	}
	public String getCategoryNamePingyin()
	{
		return categoryNamePingyin;
	}
	public void setCategoryNamePingyin(String categoryNamePingyin)
	{
		this.categoryNamePingyin = categoryNamePingyin;
	}
	public Byte getCategoryStatus()
	{
		return categoryStatus;
	}
	public void setCategoryStatus(Byte categoryStatus)
	{
		this.categoryStatus = categoryStatus;
	}
	public Integer getCategoryOrder()
	{
		return categoryOrder;
	}
	public void setCategoryOrder(Integer categoryOrder)
	{
		this.categoryOrder = categoryOrder;
	}
	public Date getCreatedDate()
	{
		return createdDate;
	}
	public void setCreatedDate(Date createdDate)
	{
		this.createdDate = createdDate;
	}
	public String getCreatedName()
	{
		return createdName;
	}
	public void setCreatedName(String createdName)
	{
		this.createdName = createdName;
	}
	public Date getUpdatedDate()
	{
		return updatedDate;
	}
	public void setUpdatedDate(Date updatedDate)
	{
		this.updatedDate = updatedDate;
	}
	public String getUpdatedName()
	{
		return updatedName;
	}
	public void setUpdatedName(String updatedName)
	{
		this.updatedName = updatedName;
	} 
	
	
	/**
     * 修改分类状态时校验
     * @param advertId
     * @param advStatus
     */
    public static void validCgStatus(Integer id,String categoryStatus){
        if (id == null) {
            throw new ServiceException(GoodCategoryModel.CATEGORY_ID_NULL);
        }
        if (categoryStatus == null) {
            throw new ServiceException(GoodCategoryModel.CATEGORY_STATUS_NULL);
        }
    }
    
	@Override 
    public String toString(){
    	return "GoodCategoryDo [id="+id+" , categoryName="+categoryName+" , categoryNamePingyin="+categoryNamePingyin
    			               +", categoryStatus="+categoryStatus+" , categoryOrder="+categoryOrder
    			               +",createdDate=" + createdDate + ", createdName="+ createdName 
    			               + ", updatedDate=" + updatedDate + ", updatedName=" + updatedName+ "]";
    }

}
